import { Request, toast, parseTime } from '../../utils/util.js'
Component({
  data: {
    orderList : []
  },

  methods : {
    load(e) {
      let rows = e.detail.list
      let page = e.detail.page
      if(page == 1 && rows.length == 0){
        this.setData({ orderList : null})
        return
      }
      if (rows.length > 0) {
        let orderList = this.data.orderList
        rows.forEach(row => {
          row.create_time = parseTime(row.create_time)
          orderList.push(row)
        })
        this.setData({ orderList: rows })
      }

    }
  },

  pageLifetimes : {
    show () {
      if (typeof this.getTabBar === 'function' &&
        this.getTabBar()) {
        this.getTabBar().setData({
          selectedIndex: 3
        })
      }
    }
  }
})